/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2022-01-09 18:18:39
 */
import SvgIcon from "@/components/SvgIcon/SvgIcon";
import React, { memo } from "react";
import { useNavigate } from "react-router-dom";

interface INavTitleProps {
  title: string;
  to?: string;
}

const NavTitle: React.FC<INavTitleProps> = memo(({ title, to }) => {
  const Navigate = useNavigate();
  // 跳转
  const toPath = () => {
    if (!to) return;
    Navigate(to);
  };
  return (
    <div className="flex items-center w-full my-3 mr-2 text-xl font-bold text-main-text-color h-7 lg:max-w-5xl">
      <span onClick={() => toPath()}>{title}</span>
      <SvgIcon
        name="next-icon"
        class="svgAutoFill"
        size={17}
        onClick={() => toPath()}
      ></SvgIcon>
    </div>
  );
});

export default NavTitle;
